package org.qqcui.designpattern.patterns.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 大学实现类
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2022/4/29 15:31
 **/
public class University extends OrganizationComponent {

    /**
     * 大学，下面有很多的系
     */
    private List<OrganizationComponent> colleges = new ArrayList<>();

    public University(String name, String desc) {
        super(name, desc);
    }

    @Override
    protected void add(OrganizationComponent org) {
        colleges.add(org);
    }

    @Override
    protected void remove(OrganizationComponent org) {
        colleges.remove(org);
    }

    @Override
    protected void print() {
        System.out.println("==============" + getName() + "===============");
        for (OrganizationComponent college : colleges) {
            college.print();
        }
    }
}
